﻿@{
    ViewBag.Title = "登录日志详情";
}
@section headerSection{
    <style>
        #exampleToolbar > .form-group {
            float: left;
            margin: 0;
            margin-left: 5px;
        }
    </style>
}
<div class="animated fadeInRight">
    <!-- Panel Other -->
    <div class="ibox float-e-margins" style="margin-bottom: 0px;">
        <div class="ibox-content" style="padding: 5px 20px 0px 20px;">
            <div class="row row-lg">
                <div class="col-sm-12 col-sm-leftRight">
                    <!-- Example Toolbar -->
                    <div class="example">
                        <table id="exampleTableToolbar" data-mobile-responsive="true" data-radio="true"></table>
                    </div>
                    <!-- End Example Toolbar -->
                </div>
            </div>
        </div>
    </div>
    <!-- End Panel Other -->
</div>
@section footSection{
    <script>
        var options, $table, user_id;
        var logManager = {
            initPage: function () {
                logManager.initTable();
            },
            //初始化Table
            initTable: function () {
                user_id = $.getUrls("user_id");
                if (!user_id)
                    layer.msg("请传递必要参数！", { icon: 5 });
                options = {
                    url: ctx + "/SysLog/GetLoginDetialList/" + user_id,
                    cutHeight: 5,
                    toolbar: "#exampleToolbar",
                    queryParams: function (params) {
                        params = {
                            //页面大小
                            rows: params.limit,
                            //第几页
                            page: params.offset / params.limit + 1
                        }
                        return params;
                    },
                    columns: [
                        {
                            field: '', //第一列序号
                            title: '序号',
                            align: 'center',
                            width: 50,
                            formatter: function(value, row, index) {
                                return index + 1;
                            }
                        }, {
                            field: 'user_name',
                            title: '用户名',
                            align: 'center'
                        }, {
                            field: 'login_name',
                            title: '登录名',
                            align: 'center'
                        }, {
                            field: 'source',
                            title: '登录来源',
                            align: 'center',
                            formatter: function (value, row, index) {
                                switch (value) {
                                    case "mobile": return "移动设备"; break;
                                    case "wechat": return "微信"; break;
                                    case "web": return "浏览器"; break;
                                    case "pc": return "PC客户端"; break;
                                    case "app": return "App"; break;
                                    case "vr": return "VR设备"; break;
                                    case "bm": return "后台管理"; break;
                                    default: return value; break;
                                }
                            }
                        }, {
                            field: 'login_date',
                            title: '登录时间',
                            align: 'center'
                        }]
                }
                $table = tableHelper.initTable("exampleTableToolbar", options);
            }
        }
        $(function() {
            logManager.initPage();
        });
    </script>
}